<html>
<head><meta charset="utf-8"><title>portability and runtimes · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html">portability and runtimes</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227843609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227843609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227843609">(Feb 25 2021 at 21:39)</a>:</h4>
<p>Hey all -- so <span class="user-mention" data-user-id="119031">@Esteban Küber</span> and I have been gathering up some data relating to portability and runtimes</p>



<a name="227843670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227843670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227843670">(Feb 25 2021 at 21:40)</a>:</h4>
<p>I've kind of been pinging random people but I wanted to move this conversation here</p>



<a name="227843758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227843758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227843758">(Feb 25 2021 at 21:40)</a>:</h4>
<p><a href="https://hackmd.io/56GNAicTQiWBC24dw1bS4A?edit">this is the document</a></p>



<a name="227843793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227843793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227843793">(Feb 25 2021 at 21:41)</a>:</h4>
<p>in particular I'm interested in improving--</p>



<a name="227843993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227843993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227843993">(Feb 25 2021 at 21:42)</a>:</h4>
<ul>
<li>lists of crates/libraries and things that are conceptually separate from the underlying runtime and where it might be nice for them to be portable</li>
<li>ways that people build portable things today and which crates/libraries use them</li>
<li>what kinds of features those crates/libraries/things use from the underlying runtime</li>
<li>what are the key "groups" of runtimes and any interesting details or distinguishing charateristics, especially as it relates to portability</li>
</ul>



<a name="227844012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227844012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227844012">(Feb 25 2021 at 21:42)</a>:</h4>
<p>also, am I missing runtimes in the list?</p>



<a name="227844072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227844072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227844072">(Feb 25 2021 at 21:43)</a>:</h4>
<p>For example I was asking <span class="user-mention" data-user-id="116883">@tmandry</span> if Fuchsia has a list of crates.io-hosted crates that they use; any such crates are presumably portable in some way, unless they are specific to Fuchsia</p>



<a name="227844392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227844392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227844392">(Feb 25 2021 at 21:45)</a>:</h4>
<p>I'm also curious about 'prior art' for ways to be portable:</p>
<ul>
<li><span class="user-mention" data-user-id="226095">@Dirkjan Ochtman</span> also mentioned <a href="https://docs.rs/futures/0.3.13/futures/task/trait.Spawn.html">the <code>Spawn</code> trait</a> in futures, but said that tokio doesn't support it because it imposes some perf overhead (I'd like to understand that)</li>
<li><span class="user-mention" data-user-id="223879">@vertexclique</span> pointed me at <a href="https://github.com/bastion-rs/agnostik">bastion-rs/agnostik</a>, I'm not sure if that crates is used by anyone though?</li>
<li>other relevant things?</li>
</ul>



<a name="227844654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227844654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227844654">(Feb 25 2021 at 21:47)</a>:</h4>
<p>I also pinged folks over in the embedded land; <span class="user-mention" data-user-id="263083">@Daniel Egger</span> mentioned <a href="https://blog.drogue.io/introducing-drogue-device/">Drogue IoT</a>, <span class="user-mention" data-user-id="119031">@Esteban Küber</span> can you add that to the document if it's not already done?</p>



<a name="227845076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227845076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227845076">(Feb 25 2021 at 21:50)</a>:</h4>
<p><span class="user-mention" data-user-id="348152">@Dario Nieuwenhuis</span> -- are you Dirbaio from embedded Matrix? :)</p>



<a name="227845261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227845261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227845261">(Feb 25 2021 at 21:51)</a>:</h4>
<p>I'd like to see <a href="https://matrix.to/#/!BHcierreUuwCMxVqOf:matrix.org/$jmLyltyo4xWSzL2vOxnStokzhWG0h1aEIrFLgcz2cN4?via=matrix.org&amp;via=sorunome.de&amp;via=matrix.coredump.ch">those points you raised on Matrix</a> incorporated into the doc -- it sounded like partly you were saying that we could factor that list of features I wrote under runtime a bit more carefully</p>



<a name="227845266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227845266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dario Nieuwenhuis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227845266">(Feb 25 2021 at 21:51)</a>:</h4>
<p>hello there! yep</p>



<a name="227845335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227845335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227845335">(Feb 25 2021 at 21:51)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/227844392">said</a>:</p>
<blockquote>
<ul>
<li><span class="user-mention silent" data-user-id="226095">Dirkjan Ochtman</span> also mentioned <a href="https://docs.rs/futures/0.3.13/futures/task/trait.Spawn.html">the <code>Spawn</code> trait</a> in futures, but said that tokio doesn't support it because it imposes some perf overhead (I'd like to understand that)</li>
</ul>
</blockquote>
<p>I mean, Tokio also doesn't support it because Tokio doesn't depend on the futures crate. The perf overhead probably has to do with an extra <code>Box</code> layer I think, though looking at it, it uses this <code>FutureObj</code> type which <em>may</em> sidestep that? Not sure.</p>



<a name="227845493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227845493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227845493">(Feb 25 2021 at 21:52)</a>:</h4>
<p>ok -- yeah I guess the question I wanted to understand was not to blame tokio for not understanding it, but to understand if there was an alternative design or something that might be preferred, and why the design is the way it is</p>



<a name="227845665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227845665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227845665">(Feb 25 2021 at 21:54)</a>:</h4>
<p>It's possible that the <code>FutureObj</code> thing they use on that trait is able to avoid the perf problems, but I've only just now become aware of <code>FutureObj</code>, so I would need to look closer.</p>



<a name="227846099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846099">(Feb 25 2021 at 21:57)</a>:</h4>
<p>Oh, so is the allocation for the future <em>object</em></p>



<a name="227846111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846111">(Feb 25 2021 at 21:57)</a>:</h4>
<p>ie., it's so that the trait is dyn-capable?</p>



<a name="227846235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846235">(Feb 25 2021 at 21:58)</a>:</h4>
<p>Yeah, if the <code>spawn</code> method is generic over the type of future you are spawning, you can't turn <code>Spawn</code> into a trait object, but then you have to take a <code>Pin&lt;Box&lt;dyn Future&gt;&gt;</code> as argument.</p>



<a name="227846282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846282">(Feb 25 2021 at 21:59)</a>:</h4>
<p>the "but" in that sentence is confusing me</p>



<a name="227846289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846289">(Feb 25 2021 at 21:59)</a>:</h4>
<p>I think you mean</p>



<a name="227846300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846300">(Feb 25 2021 at 21:59)</a>:</h4>
<p>you have to choose between:</p>



<a name="227846336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846336">(Feb 25 2021 at 21:59)</a>:</h4>
<ul>
<li>a generic <code>spawn</code>, but not <code>dyn-capable</code></li>
<li>a method that takes <code>Pin&lt;Box&lt;dyn Future&gt;&gt;</code>, which forces an allocation</li>
</ul>



<a name="227846343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846343">(Feb 25 2021 at 21:59)</a>:</h4>
<p>yep</p>



<a name="227846357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846357">(Feb 25 2021 at 21:59)</a>:</h4>
<p>I'm not sure that's 100% true though, you could have both, but it's annoying and hacky</p>



<a name="227846376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846376">(Feb 25 2021 at 21:59)</a>:</h4>
<p>and it probably has ergonomics pain</p>



<a name="227846388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846388">(Feb 25 2021 at 21:59)</a>:</h4>
<p>that helps, thanks!</p>



<a name="227846538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846538">(Feb 25 2021 at 22:00)</a>:</h4>
<p>If Spawn was written with generics, which would preclude trait objects, you would have no objections?</p>



<a name="227846755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227846755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227846755">(Feb 25 2021 at 22:02)</a>:</h4>
<p>Not being able to put the spawner into a trait object would probably be pretty painful for libraries that take a spawner as argument.</p>



<a name="227847046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227847046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227847046">(Feb 25 2021 at 22:04)</a>:</h4>
<p><span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="227847101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227847101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dario Nieuwenhuis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227847101">(Feb 25 2021 at 22:04)</a>:</h4>
<p>For embedded having to allocate is really bad :(</p>



<a name="227847227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227847227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227847227">(Feb 25 2021 at 22:05)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/227844072">said</a>:</p>
<blockquote>
<p>For example I was asking <span class="user-mention silent" data-user-id="116883">tmandry</span> if Fuchsia has a list of crates.io-hosted crates that they use; any such crates are presumably portable in some way, unless they are specific to Fuchsia</p>
</blockquote>
<p>We do: <a href="https://cs.opensource.google/fuchsia/fuchsia/+/master:third_party/rust_crates/Cargo.toml">https://cs.opensource.google/fuchsia/fuchsia/+/master:third_party/rust_crates/Cargo.toml</a></p>



<a name="227847392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227847392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227847392">(Feb 25 2021 at 22:06)</a>:</h4>
<p>There are two things in my mind:</p>
<ul>
<li>we could have a separate methods:<br>
    * <code>fn spawn_obj(&amp;self, future: FutureObj&lt;'static, ()&gt;) -&gt; Result&lt;(), SpawnError&gt;;</code><br>
    * <code>fn spawn(&amp;self, future: impl Future&lt;'static, ()&gt;) -&gt; Result&lt;(), SpawnError&gt; where Self: Sized;</code></li>
<li><code>global_allocator</code>s already are _not_ trait object safe, worth a shot to see what the experience is there</li>
</ul>



<a name="227847440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227847440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227847440">(Feb 25 2021 at 22:07)</a>:</h4>
<p>it's good to talk about solutions-- but I think it'd be better to catalog challenges</p>



<a name="227847461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227847461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227847461">(Feb 25 2021 at 22:07)</a>:</h4>
<p>for example, I'd like to consider language changes to make dyn work better :)</p>



<a name="227847859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227847859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227847859">(Feb 25 2021 at 22:10)</a>:</h4>
<p>Are you thinking of unsized locals?</p>



<a name="227849241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227849241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Egger <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227849241">(Feb 25 2021 at 22:19)</a>:</h4>
<p>Making dyn work better sounds like a great idea.</p>



<a name="227851410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227851410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227851410">(Feb 25 2021 at 22:37)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119031">Esteban Küber</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/227847859">said</a>:</p>
<blockquote>
<p>Are you thinking of unsized locals?</p>
</blockquote>
<p>I don't know yet =)</p>



<a name="227871222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227871222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taiki Endo <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227871222">(Feb 26 2021 at 02:04)</a>:</h4>
<p>futures team is also not very happy with the current Spawn and FutureObj.</p>
<p>FutureObj is basically a workaround until unsized rvalue stabilizes. See <a href="https://github.com/rust-lang/futures-rs/issues/1634#issuecomment-495513571">https://github.com/rust-lang/futures-rs/issues/1634#issuecomment-495513571</a> for more.</p>
<p>AFAIK, there are several reasons why the ecosystem doesn't use futures Spawn, one of the main reasons is stability (<a href="https://rust-lang.github.io/api-guidelines/necessities.html#public-dependencies-of-a-stable-crate-are-stable-c-stable">api-guideline's C-stable</a>) and the other is that the current Spawn API forces implementer the use of FutureObj (it's not very easy to use).</p>



<a name="227872936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227872936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taiki Endo <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227872936">(Feb 26 2021 at 02:27)</a>:</h4>
<p>Another problem with futures 0.3 Spawn is that its API doesn't support something like <a href="https://docs.rs/tokio/1.2.0/tokio/task/struct.JoinHandle.html">JoinHandle</a>.</p>



<a name="227872942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227872942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taiki Endo <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227872942">(Feb 26 2021 at 02:27)</a>:</h4>
<p>I was planning to work on these API issues in futures 0.4, but the pressure I recently received from the member of wg-async-foundation was enough to take away my energy, so I'm not sure if I can finish it.</p>



<a name="227966255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227966255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Carl Lerche <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227966255">(Feb 26 2021 at 18:00)</a>:</h4>
<p>There are also <strong>behavior</strong> differences between spawn implementations. For example, some executors cancel the spawned task when the handle is dropped, others do not.</p>



<a name="227979291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/227979291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#227979291">(Feb 26 2021 at 19:29)</a>:</h4>
<p>yes, I had that section in the doc</p>



<a name="228493313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228493313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228493313">(Mar 02 2021 at 21:55)</a>:</h4>
<p>I added some notes about fuchsia and our experience integrating hyper</p>



<a name="228506218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228506218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Gilcher <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228506218">(Mar 02 2021 at 23:30)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> there's a couple of scheduler characteristics not covered in this document, especially ones on bare-metal devices and runtimes and e.g. the ones used in gstreamer and such (Sebastian Droege is the person to contact there)</p>



<a name="228507353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228507353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228507353">(Mar 02 2021 at 23:40)</a>:</h4>
<p>That's helpful, <span class="user-mention" data-user-id="215333">@Florian Gilcher</span> -- <span class="user-mention" data-user-id="119031">@Esteban Küber</span> <span aria-label="point up" class="emoji emoji-1f446" role="img" title="point up">:point_up:</span>  maybe you want to talk to Sebastian Droege</p>



<a name="228507487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228507487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228507487">(Mar 02 2021 at 23:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> re: GNOME/Rust runtime, right?</p>



<a name="228507496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228507496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228507496">(Mar 02 2021 at 23:41)</a>:</h4>
<p>right</p>



<a name="228507782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228507782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228507782">(Mar 02 2021 at 23:44)</a>:</h4>
<p><span class="user-mention" data-user-id="215333">@Florian Gilcher</span> do you have specific thoughts about bare-metal devices or suggestions for who to talk to? I've been talking some to <span class="user-mention" data-user-id="348152">@Dario Nieuwenhuis</span></p>



<a name="228508322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228508322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228508322">(Mar 02 2021 at 23:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116883">tmandry</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228493313">said</a>:</p>
<blockquote>
<p>I added some notes about fuchsia and our experience integrating hyper</p>
</blockquote>
<p>these are the notes about "lots of code", <span class="user-mention" data-user-id="116883">@tmandry</span> ?</p>



<a name="228524959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228524959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228524959">(Mar 03 2021 at 02:35)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yep</p>



<a name="228525059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228525059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228525059">(Mar 03 2021 at 02:36)</a>:</h4>
<p>I know it's a bit terse :)</p>



<a name="228525110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228525110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228525110">(Mar 03 2021 at 02:37)</a>:</h4>
<p>we were able to integrate successfully but in an ideal world it would have allowed for more reuse of hyper's code (which is tied to tokio today)</p>



<a name="228555247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228555247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Gilcher <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228555247">(Mar 03 2021 at 08:39)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink  [he/him]</span> ^^, also for RTOS like systems (which usually already have a task model)</p>



<a name="228875455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228875455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228875455">(Mar 05 2021 at 00:24)</a>:</h4>
<p><span class="user-mention" data-user-id="243965">@Sean McArthur</span> I was talking to <span class="user-mention" data-user-id="269568">@Jacob Rothstein</span> about the web framework he's been building, which aims to be truly portable across runtimes, and I thought he might be a useful person to check out some of the stories you've been working on and/or provide some data :)</p>



<a name="228875521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228875521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228875521">(Mar 05 2021 at 00:25)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="228875730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228875730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228875730">(Mar 05 2021 at 00:27)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span> is the framework public? or do you prefer to chat in private?</p>



<a name="228875774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228875774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228875774">(Mar 05 2021 at 00:27)</a>:</h4>
<p>happy to share whatever mistakes i'm making! repo is still private, but there are async-std, standalone smol, and tokio runtimes. the networking layer and task blocking and  spawning are the only parts that are runtime-specific currently</p>



<a name="228875867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228875867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228875867">(Mar 05 2021 at 00:28)</a>:</h4>
<p>(cc <span class="user-mention" data-user-id="119031">@Esteban Küber</span> too)</p>



<a name="228875872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228875872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228875872">(Mar 05 2021 at 00:28)</a>:</h4>
<p>it's still private, but i'm happy to share it with you and it will be open source</p>



<a name="228875947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228875947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228875947">(Mar 05 2021 at 00:29)</a>:</h4>
<p>That would be great, but talking about it is also useful. What are the biggest challenges you're encountering so far?</p>



<a name="228875971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228875971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228875971">(Mar 05 2021 at 00:29)</a>:</h4>
<p>And what was the motivation to make it runtime agnostic?</p>



<a name="228876107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228876107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228876107">(Mar 05 2021 at 00:31)</a>:</h4>
<p>motivation to make it runtime agnostic is the hardest part of that to answer — i think it was initially "to see how hard it would be" but also because it would keep me from assuming any particular library was around, as i noticed frequently happened when working on tide</p>



<a name="228876245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228876245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228876245">(Mar 05 2021 at 00:32)</a>:</h4>
<p>and working on tide and other http-rs crates, there were often issues asking for tokio support, but the suggested approach was to compile both and use compatibility features</p>



<a name="228876586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228876586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228876586">(Mar 05 2021 at 00:35)</a>:</h4>
<p>i also have chatted with a bunch of new async rust developers interested in web dev about how to get started, and the story is "well, first you have to choose a runtime, and that will determine the ecosystem available to you"</p>



<a name="228876701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228876701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228876701">(Mar 05 2021 at 00:36)</a>:</h4>
<p>and to the extent that i want this project i'm working on to be approachable, i want to make runtime selection orthogonal, even if i have a default recommendation (which currently is smol)</p>



<a name="228876937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228876937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228876937">(Mar 05 2021 at 00:40)</a>:</h4>
<p>other upsides: i'm also interested in eventually supporting bastion at some point, and my runtime entrypoint allows me to consider aws lambda "a runtime" even though i'm currently running inside of tokio</p>



<a name="228877323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228877323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228877323">(Mar 05 2021 at 00:44)</a>:</h4>
<p>for tokio, I currently use async-compat to make tokio tcpstreams AsyncRead and AsyncWrite, and from there on it's all fairly straightforward, to the extent that a http implementation and web framework can be straightforward</p>



<a name="228877532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228877532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228877532">(Mar 05 2021 at 00:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="269568">Jacob Rothstein</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228876586">said</a>:</p>
<blockquote>
<p>i also have chatted with a bunch of new async rust developers interested in web dev about how to get started, and the story is "well, first you have to choose a runtime, and that will determine the ecosystem available to you"</p>
</blockquote>
<p>I can see how that'd be daunting to a newcomer, for sure. I dunno if this helps, when someone asks me about making a web server, I tell them there's several frameworks around, and picking one depends on your preferred style. There's the attribute/macro style, functional and composing, table-of-contents router... sometimes they then tell me what framework they're most used to, and it's easier to recommend they go look at a similar style in Rust.</p>



<a name="228877638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228877638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228877638">(Mar 05 2021 at 00:46)</a>:</h4>
<p>In one way, that completely skips the runtime aspect, but sometimes they may come back and wonder about runtimes afterwards, so I dunno...</p>



<a name="228877695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228877695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228877695">(Mar 05 2021 at 00:47)</a>:</h4>
<p>it does skip the runtime selection, but then at some point they run into "this other library i want to use assumes and requires the runtime that my preferred library doesn't use, what do i do?"</p>



<a name="228877707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228877707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228877707">(Mar 05 2021 at 00:47)</a>:</h4>
<p>/me nods</p>



<a name="228877718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228877718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228877718">(Mar 05 2021 at 00:48)</a>:</h4>
<p>in http-rs land, that was often "i want to use tide and surf, but i also want to use rusoto"</p>



<a name="228877988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228877988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228877988">(Mar 05 2021 at 00:50)</a>:</h4>
<p>Jumping in to note that at work, we use Tide &amp; Rusoto together, for better or worse</p>



<a name="228878121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228878121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228878121">(Mar 05 2021 at 00:51)</a>:</h4>
<p>yep, it's totally possible — it's just an example of the sort of thing that gets awkward when people just pick their favorite framework and assume unrelated libraries can be mixed and matched easily</p>



<a name="228878234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228878234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228878234">(Mar 05 2021 at 00:52)</a>:</h4>
<p>Honestly, async-compat made it very easy. but it's the kind of thing you'd need to look for, which while i do, I couldn't expect most of my coworokers to know where to look</p>



<a name="228878270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228878270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228878270">(Mar 05 2021 at 00:53)</a>:</h4>
<p>another broad pain point of doing runtime-independent development: it's not necessarily better when a library has feature flags for async-std vs tokio like sqlx does, since those flags need to get propagated up through dependencies to the user's application</p>



<a name="228878312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228878312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228878312">(Mar 05 2021 at 00:54)</a>:</h4>
<p>the sqlx story has been pretty good for us on the runtime end, haven't had issues with async there</p>



<a name="228878391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228878391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228878391">(Mar 05 2021 at 00:54)</a>:</h4>
<p>true, but your code is entirely async-std-native, right?</p>



<a name="228878401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228878401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228878401">(Mar 05 2021 at 00:54)</a>:</h4>
<p>Yeah, aside from Rusoto</p>



<a name="228878624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228878624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228878624">(Mar 05 2021 at 00:57)</a>:</h4>
<p>the feature flag pain isn't one i've really had to wrangle with yet, so it might compose just fine without my code needing to know which flavor they're using</p>



<a name="228878835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228878835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228878835">(Mar 05 2021 at 00:59)</a>:</h4>
<p>Regarding choosing a runtime though, I have seen people run into issues, and some code at my employer used 3(!) runtimes prior to my arrival.<br>
(I've moved us to reduce that where possible - I'm a bit wary on an observability / predictability point of view.)</p>
<p>I also see a lot of people <del>weary</del> wary of choosing a runtime, I suppose just because it's explicit. After all, if you choose e.g. Node.js, you are choosing a runtime. And there are, I think, multiple ruby runtimes.</p>



<a name="228879022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228879022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228879022">(Mar 05 2021 at 01:01)</a>:</h4>
<p>"weary" as in tired? Because they have to pick one often?</p>



<a name="228879024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228879024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228879024">(Mar 05 2021 at 01:01)</a>:</h4>
<p>there are multiple ruby interpreters (cruby, jruby, rubinius, and the embedded one), which isn't quite the same. and they all have rubyspec to keep their behavior as close to cruby as possible</p>



<a name="228879049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228879049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228879049">(Mar 05 2021 at 01:01)</a>:</h4>
<p>"weary" as in hesitant, I'd say, or maybe also, frustrated, I'm not sure.</p>



<a name="228879131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228879131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228879131">(Mar 05 2021 at 01:02)</a>:</h4>
<p>ah ok, wary. yea that's what i thought at first.</p>



<a name="228879262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228879262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228879262">(Mar 05 2021 at 01:03)</a>:</h4>
<p>as an intermediate async rust developer: i have read the code of several executors and i still don't have a great sense of the design tradeoffs and differences or how/why to guide a decision between them on technical merits</p>



<a name="228879553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228879553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228879553">(Mar 05 2021 at 01:06)</a>:</h4>
<p>and the fact that runtimes (executors) aren't independent of "async kitchen sink libraries/toolkits/ecosystems" like tokio and async-std is even more confusing, because it's not actually a decision about the perf characteristics of the executors often</p>



<a name="228879787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228879787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228879787">(Mar 05 2021 at 01:08)</a>:</h4>
<p>I did kinda want the <code>futures</code> crate to have most of the non runtime stuff, in general. It was mentioned in Tokio's discord that one of the advantages of having some of those things (like channels or mutex etc) is that they can use the private "scheduler task coop" api to reduce task starvation</p>



<a name="228879888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228879888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228879888">(Mar 05 2021 at 01:09)</a>:</h4>
<p>Simple example of that is <code>while let Some(doodad) = rx.next().await { .. }</code> can make the task hog the entire thread if the channel is ready fast enough.</p>



<a name="228880000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228880000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228880000">(Mar 05 2021 at 01:10)</a>:</h4>
<p>i'm not familiar with the details of that, but i've only been using generic futures stuff that can't reach into the executor/runtime. are any of those hooks universal enough to be generic?</p>



<a name="228880252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228880252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228880252">(Mar 05 2021 at 01:12)</a>:</h4>
<p>I mean, possibly. But the Tokio team so far isn't even certain enough of the exact API to make it public, so making it generic is another step after that...</p>



<a name="228880883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228880883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Rothstein <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228880883">(Mar 05 2021 at 01:18)</a>:</h4>
<p>a consequence of that sort of thing is that it means that third party tools get a perf boost by going all-in on one runtime or the other, which is itself a tradeoff the end user would need to make. but as long as less-optimized futures crate stuff works, that seems like a good trade to make for many users, as async rust on the web is probably "fast enough" for many use cases compared to whatever else they've been using</p>



<a name="228931529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228931529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228931529">(Mar 05 2021 at 10:33)</a>:</h4>
<p>I'm reading back over this -- I want to try and extract the key takeaways...</p>



<a name="228932307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228932307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228932307">(Mar 05 2021 at 10:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="319552">Jeremiah Senkpiel</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228878234">said</a>:</p>
<blockquote>
<p>Honestly, async-compat made it very easy. but it's the kind of thing you'd need to look for, which while i do, I couldn't expect most of my coworokers to know where to look</p>
</blockquote>
<p>I'd be curious, <span class="user-mention" data-user-id="319552">@Jeremiah Senkpiel</span> or <span class="user-mention" data-user-id="269568">@Jacob Rothstein</span>, to hear a bit more details about this interop. For example, I've heard from others that they get confused they don't realize that there's an initialization step required for the tokio runtime before it can be used. I'm curious if there's a resource that you point people to that explains how to set things up?</p>



<a name="228932346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228932346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228932346">(Mar 05 2021 at 10:41)</a>:</h4>
<p>Also, it seems to me that running two runtimes like this is more of a workaround than a proper solution. Does anyone disagree?</p>



<a name="228932444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228932444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228932444">(Mar 05 2021 at 10:42)</a>:</h4>
<p>I would however be interested to hear about cases where people actively <strong>want</strong> or <strong>need</strong> to have two runtimes -- my assumption is that this would come up in scenarios where one of those runtimes comes from outside Rust, such as the operating system (maybe Mac grand central dispatch) or the environment (e.g., maybe the windowing system has a runtime dispatching events)</p>



<a name="228933035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228933035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228933035">(Mar 05 2021 at 10:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="269568">Jacob Rothstein</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228878270">said</a>:</p>
<blockquote>
<p>another broad pain point of doing runtime-independent development: it's not necessarily better when a library has feature flags for async-std vs tokio like sqlx does, since those flags need to get propagated up through dependencies to the user's application</p>
</blockquote>
<p>can you elaborate on this -- by "propagated through dependencies", I think you mean -- the final application has to add a dependency on sqlx just to specify feature flags, but that is weird, because maybe the final application doesn't even know that sqlx is in use?</p>



<a name="228933040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228933040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228933040">(Mar 05 2021 at 10:47)</a>:</h4>
<p>(or would prefer not to know)</p>



<a name="228933159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228933159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228933159">(Mar 05 2021 at 10:48)</a>:</h4>
<p><span class="user-mention silent" data-user-id="319552">Jeremiah Senkpiel</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228878835">said</a>:</p>
<blockquote>
<p>Regarding choosing a runtime though, I have seen people run into issues, and some code at my employer used 3(!) runtimes prior to my arrival.<br>
(I've moved us to reduce that where possible - I'm a bit wary on an observability / predictability point of view.)</p>
</blockquote>
<p>I'd really like to hear specifics, <span class="user-mention" data-user-id="319552">@Jeremiah Senkpiel</span>, about those issues -- also how did it come to happen that they had 3 runtimes?</p>



<a name="228933230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228933230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228933230">(Mar 05 2021 at 10:49)</a>:</h4>
<p>We're going to need to know specifics if we're going to write the <a href="https://rust-lang.github.io/wg-async-foundations/vision/status_quo.html">status quo stories</a> properly :)</p>



<a name="228933400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228933400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228933400">(Mar 05 2021 at 10:50)</a>:</h4>
<p>I'm sensing there's a good story here</p>



<a name="228933981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228933981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228933981">(Mar 05 2021 at 10:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228931529">said</a>:</p>
<blockquote>
<p>I'm reading back over this -- I want to try and extract the key takeaways...</p>
</blockquote>
<p>ok, I made some <a href="https://hackmd.io/qWochQxbQAiqwf0vYVJfqw?edit">notes in a hackmd</a> -- I'd love it <span class="user-mention" data-user-id="269568">@Jacob Rothstein</span>, <span class="user-mention" data-user-id="319552">@Jeremiah Senkpiel</span>, <span class="user-mention" data-user-id="243965">@Sean McArthur</span>, and <span class="user-mention" data-user-id="119031">@Esteban Küber</span> if y'all wanted to take a look. I also left various <strong>Niko asks</strong> sections that cover some of my questions :) I'd like to elaborate these a bit more and then move them eventually into the <a href="https://rust-lang.github.io/wg-async-foundations/conversations.html">conversations section</a></p>



<a name="228990718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228990718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228990718">(Mar 05 2021 at 17:20)</a>:</h4>
<p><strong>Regarding async-compat:</strong></p>
<p>I don't know of any doc beyond the docs for async-compat itself: <a href="https://crates.io/crates/async-compat">https://crates.io/crates/async-compat</a></p>
<p>I knew about the tokio executor initialization thing, but forgot and still ran into that problem. It was annoying.<br>
I can't say I am sure what benefit it gives tokio to require this but I do think that people in a primarily async-std/smol codebase likely find it offputting.</p>
<p>The code we really needed this for is to stream a body from Rusoto out through a Tide api unaltered, code like such:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">Body</span>::<span class="n">from_reader</span><span class="p">(</span><span class="n">BufReader</span>::<span class="n">new</span><span class="p">(</span><span class="n">data</span><span class="p">.</span><span class="n">into_async_read</span><span class="p">().</span><span class="n">compat</span><span class="p">()),</span><span class="w"> </span><span class="nb">None</span><span class="p">,)</span><span class="w"></span>
</code></pre></div>



<a name="228990874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228990874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228990874">(Mar 05 2021 at 17:21)</a>:</h4>
<p>Frankly, we'd rather not be interfacing with tokio for this. It is a compromise of the AWS api being so complicated that we're willing to compromise to get an 'on-rails' client for it.</p>



<a name="228991248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228991248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228991248">(Mar 05 2021 at 17:23)</a>:</h4>
<blockquote>
<p>nikomatsakis: </p>
<p>the final application has to add a dependency on sqlx just to specify feature flags, but that is weird, because maybe the final application doesn't &gt; even know that sqlx is in use?</p>
<p>nikomatsakis: (or would prefer not to know)</p>
</blockquote>
<p>This is maybe surprising but isn't much of an issue, a walk through <code>cargo tree</code> looking for tokio found us (not speaking for Jacob) all of the places tokio was actually being used (and wasn't just there for compat).</p>



<a name="228991776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228991776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228991776">(Mar 05 2021 at 17:27)</a>:</h4>
<p>(Personally, I'd also like to avoid pulling it in as a compat dep when no compat is needed, for build times and size.)</p>
<p>(This is also what <a href="https://github.com/bikeshedder/deadpool/issues/88">https://github.com/bikeshedder/deadpool/issues/88</a> is about.)</p>



<a name="228994306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228994306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228994306">(Mar 05 2021 at 17:43)</a>:</h4>
<p><strong>Regarding the multi-runtime thing:</strong></p>
<p>Ok so, my employer's first (tiny) Rust service:</p>
<p>A slackbot for posting build &amp; deploy statuses to a slack channel with per-build/deploy threading.</p>
<ul>
<li>Tide was used as the external "post to this" http api.(my colleagues chose Tide already before I arrived, despite it also being my own preference - this is because they believed it to be the best candidate to be able to hand to non-deeply-rust developers.)</li>
<li>Surf was used as the "post to slack" http client. (Likely to go hand in hand with Tide)</li>
<li>The Redis crate was used for redis, to remember some id's for threading.</li>
<li>Smol was used as the executor because it was new and shiny at the time and one of my colleagues liked it. (It was used with the <code>"tokio02"</code> feature.)</li>
</ul>
<p>This ends up pulling 3 executors in and I believe actually using two (and also, a third or more threadpool(s) in C):</p>
<ul>
<li>Tide &amp; Surf  pull in async-std regardless of specifying smol, although then they do not execute off of it.</li>
<li>Redis by default pulls in and uses Tokio (as far as I remember)</li>
<li>Using smol here did not really have much advantage, async-std very soon after switched internally to smol and then later to the underlying crate, async-executor, and then later to async-global-executor (the same thing but globally shared).</li>
<li>Surf by default uses libcurl through isahc (we still use this but we are looking to move away, something I'm working on)</li>
</ul>
<p>Most of this was made cleaner by:</p>
<ul>
<li>Removing smol directly, using <code>#[async_std::main]</code></li>
<li>Setting the redis features to <code>[ "aio", "async-std-comp" ]</code></li>
</ul>



<a name="228995478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228995478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228995478">(Mar 05 2021 at 17:51)</a>:</h4>
<p>Thinking through what a user would experience, if they pick a web framework that is agnostic over runtimes, then in order for them to get the thing up and running, don't they then need to go decide on a runtime anyways? I think that's fine, but it also seems to bump into that users are "wary" of having to pick one.</p>



<a name="228996292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228996292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228996292">(Mar 05 2021 at 17:56)</a>:</h4>
<p>Seeing that story of how you added more and more dependencies, and how you made the decisions, is really useful!</p>



<a name="228996309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/228996309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#228996309">(Mar 05 2021 at 17:56)</a>:</h4>
<p>As I investigate each of these libraries (some are new to me (hadn't seen deadpool, looks cool!)), I notice that Tide (and Surf) both uses async-std without an option to pick another (I suppose the suggestion there is to enable async-std's compat?). I'm curious how much that affects ones decision to use a particular runtime. If Tide had the option to use a different one completely, would that have influenced anything, or was your decision for other reasons (if we ignore someone wanting to try something "new and shiny").</p>



<a name="229002559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229002559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229002559">(Mar 05 2021 at 18:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228932444">said</a>:</p>
<blockquote>
<p>I would however be interested to hear about cases where people actively <strong>want</strong> or <strong>need</strong> to have two runtimes -- my assumption is that this would come up in scenarios where one of those runtimes comes from outside Rust, such as the operating system (maybe Mac grand central dispatch) or the environment (e.g., maybe the windowing system has a runtime dispatching events)</p>
</blockquote>
<p>How does multiple runtimes interact with I want multiple drivers? In this I don't see a clear definition of runtime and I think that makes it even more confusing. As a user they should be able to pick and choose those drivers and use the same executor i think that is ideal. But like right now if a user wants to use libaio/io_uring they would need to add another "runtime" or driver with its own thread. There is likely some intersection here.</p>



<a name="229004182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229004182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229004182">(Mar 05 2021 at 18:46)</a>:</h4>
<p><span class="user-mention" data-user-id="207781">@Lucio Franco</span> yes likely! I feel like we tend to 'bundle up' a few things into the word 'runtime' (reactor, executor, utilities maybe?) and we probably want eventually some portability across those</p>



<a name="229004481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229004481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229004481">(Mar 05 2021 at 18:48)</a>:</h4>
<p>I think a big win that would be pretty easy is to very clearly define these terms (and maybe change some!) because I think a lot of the confusion new users have is what is a runtime? What is a reactor?</p>



<a name="229004633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229004633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229004633">(Mar 05 2021 at 18:49)</a>:</h4>
<p>I personally have found async-compat quite useful as well. I wish I had known about it early in my adventures of learning async.</p>



<a name="229004838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229004838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229004838">(Mar 05 2021 at 18:51)</a>:</h4>
<p>I spent a while in the general mindset of "there are multiple choices here, everything doesn't automatically interoperate, so this must not be mature enough for me to want to get into,. I'll just write sync code".</p>



<a name="229005076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229005076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229005076">(Mar 05 2021 at 18:52)</a>:</h4>
<p>Then when smol and async-std aligned, and I found async-compat, I realized that I didn't have to choose. This was around the time I was starting to experiment with the mindset of "don't worry about calling clone, wait to optimize until you know you need to".</p>



<a name="229005149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229005149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229005149">(Mar 05 2021 at 18:53)</a>:</h4>
<p>So now I just use smol/async-std, and use async-compat when I need to call a library that needs them.</p>



<a name="229005186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229005186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229005186">(Mar 05 2021 at 18:53)</a>:</h4>
<p>And I no longer feel like I'm limited to a subset of the ecosystem.</p>



<a name="229006058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229006058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229006058">(Mar 05 2021 at 18:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/229004838">said</a>:</p>
<blockquote>
<p>"there are multiple choices here, everything doesn't automatically interoperate, so this must not be mature enough for me to want to get into".</p>
</blockquote>
<p>Hm, interesting! I'm certain some others will feel the same way, so worth understanding better. And in other places, people accept that things don't work together more easily, like if I look in Java or Scala, right?</p>



<a name="229012221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229012221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229012221">(Mar 05 2021 at 19:38)</a>:</h4>
<blockquote>
<p>nikomatsakis: I would however be interested to hear about cases where people actively want or need to have two runtimes -- my assumption is that this would come up in scenarios where one of those runtimes comes from outside Rust, such as the operating system (maybe Mac grand central dispatch) or the environment (e.g., maybe the windowing system has a runtime dispatching events)</p>
</blockquote>
<p>Maybe the GTK folks have a view on this, since I think they'll usually operate within the glib event loop?</p>



<a name="229012879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229012879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229012879">(Mar 05 2021 at 19:42)</a>:</h4>
<p><span class="user-mention" data-user-id="226095">@Dirkjan Ochtman</span> yeah, I was thinking that</p>



<a name="229012908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229012908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229012908">(Mar 05 2021 at 19:43)</a>:</h4>
<p>I did ping <span class="user-mention" data-user-id="301846">@Sebastian Dröge</span> and try to setup a time to talk to him about it, not sure if there are others worth pinging</p>



<a name="229012962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229012962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229012962">(Mar 05 2021 at 19:43)</a>:</h4>
<p>that's also the primary name I could come up with</p>



<a name="229013507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229013507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229013507">(Mar 05 2021 at 19:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="319552">Jeremiah Senkpiel</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228991248">said</a>:</p>
<blockquote>
<p>This is maybe surprising but isn't much of an issue, a walk through <code>cargo tree</code> looking for tokio found us (not speaking for Jacob) all of the places tokio was actually being used (and wasn't just there for compat).</p>
</blockquote>
<p>that makes sense. Seems like something you have to know to do, though.</p>



<a name="229015508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229015508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sebastian Dröge <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229015508">(Mar 05 2021 at 20:01)</a>:</h4>
<p>(not really following here, just got a notification that my name was mentioned) apart from gstreamer, i'm also the one who wrote the async integration in gtk-rs. we can also talk about that next week <span class="user-mention" data-user-id="116009">@nikomatsakis</span> for usage for building GTK UIs, Bodil Stokke (vgtk) and Antoni Boucher (relm) might be worth talking to. vgtk uses futures all over the place, relm might be especially interesting because it used futures long ago but moved away for some reason i don't know/remember</p>



<a name="229015565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229015565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229015565">(Mar 05 2021 at 20:02)</a>:</h4>
<p>ah, nice</p>



<a name="229015634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229015634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229015634">(Mar 05 2021 at 20:02)</a>:</h4>
<p>ok</p>



<a name="229015819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229015819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sebastian Dröge <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229015819">(Mar 05 2021 at 20:03)</a>:</h4>
<p>relm/vgtk are basically elm/react/etc inspired APIs on top of gtk</p>



<a name="229015856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229015856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229015856">(Mar 05 2021 at 20:03)</a>:</h4>
<p>maybe you can send me their emails</p>



<a name="229015877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229015877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229015877">(Mar 05 2021 at 20:03)</a>:</h4>
<p>or I think maybe I have see them on twitter</p>



<a name="229016601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229016601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sebastian Dröge <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229016601">(Mar 05 2021 at 20:08)</a>:</h4>
<p>sure, sent you a mail with the details :)</p>



<a name="229022511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229022511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229022511">(Mar 05 2021 at 20:51)</a>:</h4>
<p><span class="user-mention silent" data-user-id="243965">Sean McArthur</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/228996309">said</a>:</p>
<blockquote>
<p>As I investigate each of these libraries (some are new to me (hadn't seen deadpool, looks cool!)), I notice that Tide (and Surf) both uses async-std without an option to pick another (I suppose the suggestion there is to enable async-std's compat?). I'm curious how much that affects ones decision to use a particular runtime. If Tide had the option to use a different one completely, would that have influenced anything, or was your decision for other reasons (if we ignore someone wanting to try something "new and shiny").</p>
</blockquote>
<p>Yeah the suggestion we (the http-rs folks) would make is to enable compat on async-std and/or use async-compat.<br>
<em>(Edit: particularly for Tide. I'm pretty sure Tide technically can have swappable backends too, but there isn't a hyper one written. Surf can use a hyper backend but is pretty bare-bones (and also has no option to use rustls).)</em></p>
<p>Both myself and my employer were picking lighter weight, easier to understand options than tokio regardless.<br>
(Note that a lot of that decision making happened almost a year ago, I know tokio has moved closer to just using futures now, which I personally think is a good thing.)</p>



<a name="229022942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229022942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229022942">(Mar 05 2021 at 20:53)</a>:</h4>
<p>Speaking of rustls... We have similar issues between native-tls and rustls, and choosing one or the other, or knowing what crates can or can't support one or the other.</p>



<a name="229028335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229028335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229028335">(Mar 05 2021 at 21:32)</a>:</h4>
<blockquote>
<p>What is a reactor?</p>
</blockquote>
<p>Also I'm going to throw this in here. <strong>I</strong> <em>still</em> have no idea what a reactor is or why I'd need one. <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="229029817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229029817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229029817">(Mar 05 2021 at 21:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="319552">Jeremiah Senkpiel</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes/near/229028335">said</a>:</p>
<blockquote>
<blockquote>
<p>What is a reactor?</p>
</blockquote>
<p>Also I'm going to throw this in here. <strong>I</strong> <em>still</em> have no idea what a reactor is or why I'd need one. <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>
</blockquote>
<p>The reactor is a component in the runtime that knows about all the IO resources used inside the runtime, and which knows when each IO resource is ready so it can have the runtime poll them when and only when they become ready.</p>



<a name="229029840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229029840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229029840">(Mar 05 2021 at 21:45)</a>:</h4>
<p><del>(Turns out it's a fancy name for a task scheduler!)</del></p>



<a name="229030080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229030080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229030080">(Mar 05 2021 at 21:47)</a>:</h4>
<p>I mean, it's not really the task scheduler. The task scheduler is the one who actually runs the tasks, whereas the reactor just tells the task scheduler when IO resources become ready. In particular, other resources that don't depend on the reactor (e.g. mpsc channel) would talk directly to the task scheduler, not going through the reactor at all.</p>



<a name="229030271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229030271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229030271">(Mar 05 2021 at 21:49)</a>:</h4>
<p>As I understand it, in smol the task scheduler and reactor are even entirely separate in <code>async-executor</code> and <code>async-io</code> respectively, where neither depends on the other. (but I may be wrong)</p>



<a name="229031739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229031739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremiah Senkpiel <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229031739">(Mar 05 2021 at 22:01)</a>:</h4>
<p>So it is an io polling event loop, and the task scheduler exists to thread things once we have an io event read? Is that right?</p>



<a name="229116490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229116490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229116490">(Mar 06 2021 at 18:01)</a>:</h4>
<p>Right. It's the thing that calls epoll/select/etc and then <em>reacts</em> to things.</p>



<a name="229137852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/portability%20and%20runtimes/near/229137852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ahmed Charles <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/portability.20and.20runtimes.html#229137852">(Mar 06 2021 at 23:23)</a>:</h4>
<p>The last time I checked, smol runs the io reactor on a separate thread which (on linux, for example) calls epoll and then wakes up the relevant task using <code>waker.wake()</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>